package com.spring.sunflower.common

import com.spring.sunflower.base.BaseObserver
import com.spring.sunflower.base.BasePresenter
import com.spring.sunflower.bean.*

/**
 * Created by Kevin on 2021/8/27<br/>
 *
 * Describe:<br/>
 */
class IncomePresenter(baseView: CommonContract.IncomeView) :
    BasePresenter<CommonContract.IncomeView>(baseView) {
    fun getGiftIncome(pageIndex: String) {
        val observable = requestDataSource.incomeGift(pageIndex)
        addDisposable(observable, object : BaseObserver<IncomeGiftBean>(baseView) {
            override fun onSuccess(bean: IncomeGiftBean) {
                baseView.showIncomeGift(bean.datas!!)
            }

            override fun onError(status: Int, msg: String?) {
            }
        })
    }

    fun getChatIncome(pageIndex: String) {
        val observable = requestDataSource.incomeIMChat( pageIndex)
        addDisposable(observable, object : BaseObserver<IncomeChatBean>(baseView) {
            override fun onSuccess(bean: IncomeChatBean) {
                baseView.showIncomeChat(bean.datas)
            }

            override fun onError(status: Int, msg: String?) {
            }
        })
    }

    fun getVideoChatIncome(pageIndex: String) {
        val observable = requestDataSource.incomeVideoChat(pageIndex)
        addDisposable(observable, object : BaseObserver<IncomeVideoChatBean>(baseView) {
            override fun onSuccess(bean: IncomeVideoChatBean) {
                baseView.showIncomeVideoChat(bean.datas)
            }

            override fun onError(status: Int, msg: String?) {
            }
        })
    }
}